find_package(PythonInterp REQUIRED)

# cmake needs this line
cmake_minimum_required(VERSION 3.1)

# Define project name
project(libTorchTest)

set(CMAKE_CXX_STANDARD 14)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

include_directories(${PROJECT_SOURCE_DIR}/include)
#include_directories(${OpenCV_INCLUDE_DIRS} PRIVATE ${OpenCV_INCLUDE_DIRS})

set(Torch_DIR /mnt/data/libtorch/share/cmake/Torch)  #解压的libtorch的绝对路径
find_package(Torch REQUIRED)

#set(OpenCV_DIR /home/zlzg01/Downloads/opencv-4.5.5/build)
find_package(OpenCV REQUIRED)

if(OpenCV_FOUND)
    message(STATUS "Found OpenCV")
    message(STATUS "Opencv Version:${OpenCV_VERSION}")
    message(STATUS "OpenCV Library: ${OpenCV_LIBS}")
    message(STATUS "Include path: ${OpenCV_INCLUDE_PATH}")
else()
    message(FATAL_ERROT "Could not find OpenCV library")
endif()


aux_source_directory (src SRC_LIST)

#set(CMAKE_CXX_FLAGS "-std=c++14 -O2 ${SSE_FLAGS} -msse4")

# Declare the executable target built from your sources
add_executable(test_libtorch main.cpp ${SRC_LIST})



target_include_directories(test_libtorch PRIVATE ${OpenCV_INCLUDE_DIRS})


# Link your application with OpenCV libraries
target_link_libraries(test_libtorch PRIVATE ${OpenCV_LIBS} ${TORCH_LIBRARIES})
